﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using Bll;
using System.Data;

namespace Accounting.admin
{
    public partial class Guidance : System.Web.UI.Page
    {
        BllAdmin b = new BllAdmin();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["Type"] != null)
                {
                    datashow();
                }
            }
        }

        public void datashow()
        {
            if(Session["Grade"]!=null&&Session["Type"]!=null)
            {
                string strGrade = Session["Grade"].ToString();
                string strType = Session["Type"].ToString();

                if (strGrade == "1" && strType == "0")
                {
                    Check_Grade("1");
                }
                if (strGrade != "1" && strType == "0")
                {

                    string grade = strGrade;
                    string[] arr_Grade = grade.Split(',');

                    for (int i = 0; i < arr_Grade.Length; i++)
                    {
                        Check_Grade(arr_Grade[i]);
                    }

                }
                if (strGrade != "1" && strType == "1")
                {

                    string grade = strGrade;
                    string[] arr_Grade = grade.Split(',');

                    for (int i = 0; i < arr_Grade.Length; i++)
                    {
                        Check_Grade(arr_Grade[i]);
                    }
                }
            }
        }

        private void Check_Grade(string id)
        {
            if(id=="1")
            {
                Div_Admin.Visible = true;
                Div_Email.Visible = true;
                Div_Nav.Visible = true;
                Div_News.Visible = true;
            }
            if(id=="2"||id=="3"||id=="4"||id=="5"||id=="6"||id=="7"||id=="8"||id=="9"||id=="10"||id=="11"|| id == "12" || id == "13" || id=="17")
            {
                Div_News.Visible = true;
            }
            if(id == "14")
            {
                Div_Email.Visible = true;

            }
            if(id == "15" || id == "16")
            {
                Div_Nav.Visible = true;
            }
        }
    }
}